package by.bsu.diploma.common;

import java.util.List;
import java.util.Random;

/**
 * @author Anatoly Selitsky
 */
public abstract class Util {

    public static int calcTotal(List<Word> words) {
        int total = 0;
        for(Word word : words) {
            total += word.getCount();
        }
        return total;
    }

    public static int random(int min, int max) {
        if (min > max) {
            throw new IllegalArgumentException("Min value cannot be larger max value");
        }
        int range = max - min + 1;
        return new Random().nextInt(range) + min;
    }

}
